<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>pvsftw</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="pvsftr.html" title="pvsftr" />
    <link rel="next" href="pvsfwrite.html" title="pvsfwrite" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">pvsftw</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="pvsftr.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="pvsfwrite.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="pvsftw"></a>
      <div class="titlepage"></div>
      <a id="IndexPvsftw" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">pvsftw</span>
        </h2>
        <p>pvsftw — 
      Writes amplitude and/or frequency data to function tables.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp138796560"></a>
        <h2>Description</h2>
        <p>
      Writes amplitude and/or frequency data to function tables.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp138871040"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kflag <span class="command"><strong>pvsftw</strong></span> fsrc, ifna [, ifnf]</pre>
      </div>
      <div class="refsect1">
        <a id="idp138873152"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifna</em></span> -- A table, at least inbins in size, that stores amplitude data. Ignored if ifna  = 0
    </p>
        <p>
      <span class="emphasis"><em>ifnf</em></span> -- A table, at least inbins in size, that stores frequency data. Ignored if ifnf = 0
    </p>
      </div>
      <div class="refsect1">
        <a id="idp138875776"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kflag</em></span> -- A flag that has the value of 1 when new data is available, 0 otherwise.
    </p>
        <p>
      <span class="emphasis"><em>fsrc</em></span> -- a PVOC-EX formatted source.
    </p>
        <p>
      Enables the contents of <span class="emphasis"><em>fsrc</em></span> to be exchanged with function tables, for custom processing. Except when the frame overlap equals <span class="emphasis"><em>ksmps</em></span> (which will generally not be the case), the frame data is not updated each control period. The data in <span class="emphasis"><em>ifna</em></span>, <span class="emphasis"><em>ifnf</em></span> should only be processed when <span class="emphasis"><em>kflag</em></span> is set to 1. To process only frequency data, set <span class="emphasis"><em>ifna</em></span> to zero.
    </p>
        <p>
      As the functions tables are required only to store data from <span class="emphasis"><em>fsrc</em></span>, there is no advantage in defining then in the score. They should generally be created in the instrument using <a class="link" href="ftgen.html" title="ftgen"><em class="citetitle">ftgen</em></a>.
    </p>
        <p>
      By exporting amplitude data, say, from one fsig and importing it into another, basic cross-synthesis (as in <a class="link" href="pvscross.html" title="pvscross"><em class="citetitle">pvscross</em></a>) can be performed, with the option to modify the data beforehand using the table manipulation opodes.
    </p>
        <p>
      Note that the format data in the source fsig is not written to the tables. This therefore offers a means of transferring amplitude and frequency data between non-identical fsigs. Used this way, these opcodes become potentially pathological, and can be relied upon to produce unexpected  results. In such cases, resynthesis using <a class="link" href="pvsadsyn.html" title="pvsadsyn"><em class="citetitle">pvsadsyn</em></a> would almost certainly be required.
    </p>
        <p>
      To perform a straight copy from one fsig to another one of identical format, the conventional assignment syntax can be used:

      </p>
        <div class="literallayout">
          <p> <br />
fsig1 = fsig2<br />
      </p>
        </div>
        <p> 
 
      It is not necessary to use function tables in this case.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp138888480"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the pvsftw opcode. It uses the file <a class="ulink" href="examples/pvsftw.csd" target="_top"><em class="citetitle">pvsftw.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp138890336"></a>
          <p class="title">
            <strong>Example 693. Example of the pvsftw opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac  <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o pvsftw.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

inbins	<span class="op">=</span>	512
ifn	<span class="ohdr">ftgen</span>	0,0,inbins,10,1		<span class="comment">; make ftable</span>
fsrc	<span class="opc">pvsdiskin</span> "fox.pvx", 1, 1	<span class="comment">; read PVOCEX file</span>
kflag	<span class="opc">pvsftw</span>	fsrc,ifn		<span class="comment">; export amps to table,</span>
kamp	<span class="opc">init</span>	0
<span class="octrl">if</span>      kflag<span class="op">==</span>0   <span class="octrl">kgoto</span> <span class="olabel">contin</span>		<span class="comment">; only proc when frame is ready							</span>
	<span class="opc">tablew</span>	kamp,1,ifn		<span class="comment">; kill lowest bins, for obvious effect</span>
	<span class="opc">tablew</span>	kamp,2,ifn
	<span class="opc">tablew</span>	kamp,3,ifn
	<span class="opc">tablew</span>	kamp,4,ifn
<span class="comment">; read modified data back to fsrc</span>
	<span class="opc">pvsftr</span>	fsrc,ifn
<span class="olabel">contin</span><span class="op">:</span>
<span class="comment">; and resynth</span>
aout	<span class="opc">pvsynth</span>	fsrc
	<span class="opc">outs</span>	aout, aout

<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 4
<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp138894624"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="pvsftr.html" title="pvsftr"><em class="citetitle">pvsftr</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp138896672"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Richard Dobson</td>
          </tr>
          <tr>
            <td>August 2001 </td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 4.13</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="pvsftr.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="pvsfwrite.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">pvsftr </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> pvsfwrite</td>
        </tr>
      </table>
    </div>
  </body>
</html>
